#!/usr/bin/env python

# 2010-05-18

import re
def word_to_num(n):
    num = 0
    for w in str(n):
        num = num + ord(w) - ord('A') + 1
    return num

def triangle_number(n):
    tri_num = []
    return [i*(i+1)/2 for i in xrange(1, n)]

if __name__ == "__main__":
    f = open('words.txt', 'r')
    count = 0
    tri = triangle_number(word_to_num('ZZZZZZZZZZZZ'))
    for line in f.readlines():
        words = line.split(',')
        for word in words:
            if word_to_num(word.strip("\"")) in tri:
                count = count + 1

    print count
